<?php
namespace app\common\model;
use app\common\cache\CacheData;

class AdminGroup extends Base
{
	
    public function cacheData(){
        $data = $this->select();
        if($data){
            foreach($data as &$value):
            	$value=$value->toArray();
            endforeach;
        }
        return $data;
    }

    public static function adminGroupData($id=null){
        $CACHE = CacheData::getInstance('AdminGroup');
        $cacheData = $CACHE -> readCache();
        $data = [];
        foreach($cacheData as $cache):
            $data[$cache['id']] = $cache;
        endforeach;
        if(!is_null($id)){
            if(isset($data[$id]))
                return $data[$id];
            return
                false;
        }else{
            return $data;
        }
    }

}